package org.zuel.lkq.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zuel.lkq.param.user.talk.PickQuestionParam;
import org.zuel.lkq.param.user.talk.QueryQuestionParam;
import org.zuel.lkq.param.user.talk.TalkCreateParam;
import org.zuel.lkq.service.AdminTalkService;

@RestController
@Api(tags = "工单系统: 管理员工单管理模块")
@RequestMapping(value="/admin_question")
public class AdminTalkController {

    public AdminTalkService adminTalkService;

    @Autowired
    public AdminTalkController(AdminTalkService adminTalkService) {
        this.adminTalkService = adminTalkService;
    }

    @ApiOperation(value = "查询自己负责的工单")
    @RequiresPermissions("admin_q:queryMine")
    @PostMapping(value = "/query_mine")
    public Object queryMyQuestion(@RequestBody QueryQuestionParam param) {
        return adminTalkService.queryMyQuestion(param);
    }


    @ApiOperation(value = "查询待接的工单")
    @RequiresPermissions("admin_q:query")
    @PostMapping(value = "/query")
    public Object queryQuestion(@RequestBody QueryQuestionParam param) {
        return adminTalkService.queryVacantQuestion(param);
    }

    @ApiOperation(value = "抢单")
    @RequiresPermissions("admin_q:pick")
    @PostMapping(value = "/pick")
    public Object pickQuestion(@RequestBody PickQuestionParam param) {
        return adminTalkService.pickQuestion(param);
    }

    @ApiOperation(value = "用户新增回复")
    @RequiresPermissions("admin_q:talk_create")
    @PostMapping(value = "/talk_create")
    public Object talkCreate(@RequestBody TalkCreateParam param) {
        return adminTalkService.createTalkDetail(param);
    }
}
